Skip to content

feat: add road engineering calculation API with FastAPI#3

Open
lrf-86 wants to merge 1 commit intobedrock-engineer:mainfrom
lrf-86:main
Open

feat: add road engineering calculation API with FastAPI#3
lrf-86 wants to merge 1 commit intobedrock-engineer:mainfrom
lrf-86:main

Conversation

@lrf-86
Copy link

@lrf-86 lrf-86 commented Mar 13, 2026

新增功能

基于 cecode 土建工程库,开发了专业的道路工程计算后端服务,使用 FastAPI 封装为 RESTful API:

  1. 道路纵坡 / 横坡计算:根据两点高程和距离计算坡度百分比与角度。
  2. 道路设计高程计算:根据起点高程、坡度和距离计算任意点的设计高程。
  3. 路基宽度与路面厚度计算:根据设计规范计算路面厚度。
  4. 道路中线坐标计算:根据起点坐标、方位角和距离计算中线上任意点的坐标。

代码特点

  • 工程化规范:采用 FastAPI 标准开发模式
  • 完整数据模型:使用 Pydantic 定义专业请求/响应模型
  • 异常处理:所有接口都有异常捕获和 HTTP 状态码返回
  • 可独立运行:直接执行 python road.py 启动服务

测试验证

所有核心功能已通过 test_road.py 测试验证,计算结果符合工程规范。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant